package com.batchOperation.tool;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Package: com.batchOperation
 * @ClassName: Response
 * @Author: wulongkai
 * @CreateTime: 2024/7/19 10:23
 * @Description:
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
public final class Response<T> {

    private Boolean success;
    private String msg;
    private T data;

    public static <T> Response<T> getSuccessResult() {
        return new Response<>(true, "success", null);
    }

    public static <T> Response<T> getSuccessResult(T data) {
        return new Response<>(true, "success", data);
    }

    public static <T> Response<T> getSuccessResult(String msg, T data) {
        return new Response<>(true, msg, data);
    }

    public static <T> Response<T> getFailureResult(String msg) {
        return new Response<>(false, msg, null);
    }

    public static <T> Response<T> getFailureResult(String msg, T data) {
        return new Response<>(false, msg, data);
    }
}

